# -*- coding: utf-8 -*-
from datetime import timedelta

from utils.operators.spark_submit import SparkSubmitOperator

from jms.dim.dim_network_whole_massage import jms_dim__dim_network_whole_massage
from jms.dim.tms.dim_tms_airport_route_base_dt import jms_dim__dim_tms_airport_route_base_dt
from jms.dim.tms.dim_tms_main_delivery_network_base_dt import jms_dim__dim_tms_main_delivery_network_base_dt
from jms.dim.tms.dim_yl_tms_route_base_dt import jms_dim__dim_yl_tms_route_base_dt
from jms.dim.tms.dim_yl_tms_cs_shift_base_dt import jms_dim__dim_yl_tms_cs_shift_base_dt
from jms.dim.tms.dim_yl_tmsnew_tms_transfer_shift_base_dt import jms_dim__dim_yl_tmsnew_tms_transfer_shift_base_dt
from jms.dim.tms.dim_yl_tmsnew_tms_vehicle_line_base_dt import jms_dim__dim_yl_tmsnew_tms_vehicle_line_base_dt
from jms.dim.tms.dim_yl_tmsnew_tms_vehicle_point_base_dt import jms_dim__dim_yl_tmsnew_tms_vehicle_point_base_dt

dm__dm_route_main = SparkSubmitOperator(
    conn_id='spark_route',
    task_id='dm__dm_route_main',
    pool_slots=17,
    email=['zhangqinglin@jtexpress.com','yl_bigdata@yl-scm.com'],
    name='dm__dm_route_main',
    driver_memory='20G',
    executor_memory='20G',
    executor_cores=4,
    num_executors=50,
    jars='hdfs:///route/package/graphframes-0.7.0-spark2.3-s_2.11.jar,hdfs:///route/package/common-1.0-SNAPSHOT.jar',
    java_class='com.yunlu.bigdata.jobs.route.export.GraphMainExport',
    application='hdfs:///route/package/main/original-jobs-1.0-SNAPSHOT.jar',
    application_args=['{{ execution_date | cst_ds }}'],
    execution_timeout=timedelta(hours=1),
)

dm__dm_route_main << [
    jms_dim__dim_yl_tms_cs_shift_base_dt,
    jms_dim__dim_yl_tmsnew_tms_transfer_shift_base_dt,
    jms_dim__dim_tms_main_delivery_network_base_dt,
    jms_dim__dim_network_whole_massage,
    jms_dim__dim_yl_tmsnew_tms_vehicle_line_base_dt,
    jms_dim__dim_yl_tmsnew_tms_vehicle_point_base_dt,
    jms_dim__dim_yl_tms_route_base_dt,
    jms_dim__dim_tms_airport_route_base_dt
]
